package m202405.d18;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/5/18 14:05
 */
public class Q45 {
    public int jump(int[] nums) {
        int steps = 0;
        for (int length = nums.length - 1; length > 0; ) {
            for (int i = 0; i < length; i++) {
                if (i + nums[i] >= length) {
                    length = i;
                    steps++;
                    break;
                }
            }
        }
        return steps;
    }
}
